package hu.vpszd.entities;

import javax.persistence.Column
import javax.persistence.Entity
import javax.persistence.Table
import javax.validation.constraints.NotNull

@Entity
@Table(name = "Role")
class Role extends BaseEntity {
	public static final Role REFERENS = new Role(name: 'REFERENS_ROLE');
	public static final Role BIRALO = new Role(name: 'BIRALO_ROLE');
	public static final Role USER = new Role(name: 'USER_ROLE');
	public static final Role ADMIN = new Role(name: 'ADMIN_ROLE');

	@Column
	@NotNull
	String name

	@Override
	public String toString() {
		name
	}
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((name == null) ? 0 : name.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (obj == null) {
			return false;
		}
		if (name == obj.name) {
			return true;
		}
		return false;
	}
}
